Page({

  /**
   * 页面的初始数据
   */
  data: {
    arr:[],
    Array:[],
    ID:0,
    show:null,
    number1:0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      ID: options.item,
      typeid:options.typeid,
    })
    console.log(this.data.ID);
  },
  
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    wx.request({
      url: 'https://bag.idianwei.com/index.php/Api/Api/orderList',
      data: {
        userId: 16,
        token: 1501221705,
      },
      success: function (res) {
        console.log(res);
        for (var i = 0; i < res.data.resultObj.length; i++) {
          if (res.data.resultObj[i].orderId.indexOf(that.data.ID) != -1) {
            that.setData({
              Array: res.data.resultObj[i],
            })
          }
        }
        if (that.data.typeid == "0"){
          that.setData({
            show:0,
          })
        } else if (that.data.typeid == "1"){
          that.setData({
            show: 1,
            zu_money:1.9,
            zu_lenth: that.data.Array.goodsInfo[0].zu_lenth,
            num: 1.9 * that.data.Array.goodsInfo[0].zu_lenth,
          })
          console.log(that.data.num);
        } else if (that.data.typeid == "2") {
          that.setData({
            show: 2,
            num: that.data.Array.goodsInfo[0].goodsNums * that.data.Array.goodsInfo[0].goodsPrice,
          })
          console.log(that.data.Array);
        } else if (that.data.typeid == "3") {
          that.setData({
            show: 3,
            number1:1,
          })
          console.log(that.data.Array);
        }
      }
    })
  },
  Return:function(){
    wx: wx.navigateTo({
      url: '/pages/index/Returnof/Returnof?id='+this.data.ID,
    })
  },
  tui_1:function(){
    wx:wx.showModal({
      title: '提示',
      content: '退货中',
    })
  },
  tui_2: function () {
    wx: wx.showModal({
      title: '提示',
      content: '已退货',
    })
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})